Page({
  data: {
    // 标签页状态
    activeTab: 'projects',
    // 非遗项目数据
    heritageProjects: [
      { id: 1, title: '饶镇多声部民歌', date: '2024-04-23', views: '127', imageUrl: '/static/images/heritage1.svg' },
      { id: 2, title: '荣经砂器烧制技艺', date: '2024-04-23', views: '103', imageUrl: '/static/images/heritage2.svg' },
      { id: 3, title: '蒙山茶传统制作技艺', date: '2024-04-23', views: '98', imageUrl: '/static/images/heritage3.svg' },
      { id: 4, title: '南路边茶制作技艺', date: '2024-04-23', views: '86', imageUrl: '/static/images/heritage4.svg' }
    ],
    // 非遗传承人数据
    heritageInheritors: [
      { id: 1, name: '张跃华', avatar: '/static/images/inheritor1.svg', skill: '传统技艺', area: '名山区' },
      { id: 2, name: '曾庆红', avatar: '/static/images/inheritor2.svg', skill: '传统技艺', area: '荣经县' },
      { id: 3, name: '甘玉祥', avatar: '/static/images/inheritor3.svg', skill: '传统技艺', area: '雨城区' },
      { id: 4, name: '杨明星', avatar: '/static/images/inheritor4.svg', skill: '传统音乐', area: '宝兴县' }
    ]
  },

  // 切换标签页
  switchTab(e) {
    const tab = e.currentTarget.dataset.tab
    this.setData({
      activeTab: tab
    })
  },

  // 点击非遗项目
  onProjectTap(e) {
    const id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: `/pages/heritage/detail/index?id=${id}&type=project`
    })
  },

  // 点击非遗传承人
  onInheritorTap(e) {
    const id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: `/pages/heritage/detail/index?id=${id}&type=inheritor`
    })
  }
})